<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<head>
	<meta charset="UTF-8">
    <title>添加矩形</title>
    <%@ include file="head.jsp" %>
</head>
<body>
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">设备X坐标</label>
        <div class="layui-input-block">
            <input type="text" name="map_x" required  lay-verify="required" placeholder="请输一个数字" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">设备Y坐标</label>
        <div class="layui-input-block">
            <input type="text" name="map_y" required  lay-verify="required" placeholder="请输入一个数字" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">半径</label>
        <div class="layui-input-block">
            <input type="text" name="eq_width" required  lay-verify="required" placeholder="请输入一个数字" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">设备高度</label>
        <div class="layui-input-block">
            <input type="text" name="eq_height"  placeholder="请输入一个数字,如果没有高度可以不填" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">设备名字</label>
        <div class="layui-input-block">
            <input type="text" name="eq_name" required  lay-verify="required" placeholder="请输入设备名字" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">温度上限</label>
        <div class="layui-input-block">
            <input type="text" name="eq_temp_height" required  lay-verify="required" placeholder="单位℃" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">温度下限</label>
        <div class="layui-input-block">
            <input type="text" name="eq_temp_low" required  lay-verify="required" placeholder="单位℃" autocomplete="off" class="layui-input">
        </div>
    </div>
    
    <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <input type="text" name="eq_note" required   placeholder="输入备注" autocomplete="off" class="layui-input">
            </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-sm" lay-submit lay-filter="formDemo">确定</button>
            <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary">重置</button>
        </div>
    </div>

</form>



<script>
    //Demo
    layui.use('form', function(){
    	 var form = layui.form;
         var $ = layui.$;
         var element = layui.element;
         var layer = layui.layer;
         
        form.on('submit(formDemo)', function(data,index){
            var data1 = JSON.stringify(data.field);
			
            $.post("addBase_eq","data="+data1,function(msg){

				if(msg == "success"){
					parent.location.reload();
				}
            });
			
            layer.close(index);
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index);

            
            return false;
        });
    });
</script>



</body>
</html>